import asyncio
import psutil
import socket
import threading
from io import BytesIO
from PIL import Image
from PIL import ImageGrab
import lzma
import json
import os
import win32clipboard
import win32api
import win32con
import win32gui
import time
import subprocess
import sys
import configparser
import websockets
import pythoncom
from win32com.taskscheduler import taskscheduler
import wx
import wx.adv
import base64
import images
from multiprocessing import Queue,Process
#import winreg


import key_mouse_api
import async_user
import model_gui



if __name__ == "__main__":
    if len(sys.argv) > 1:
        if sys.argv[1] == "add":
            key_mouse_api.task_taskscheduler(os.path.abspath(sys.argv[0]),'myapp','myapp')
        elif sys.argv[1] == "del":
            key_mouse_api.task_taskscheduler(os.path.abspath(sys.argv[0]),'myapp','myapp',n=True)
        elif sys.argv[1] == "run":
            queue = Queue()
            wx_app = wx.App()
            model_gui.MyFramelogin(None,queue).Show(False)
            wx_app.MainLoop()
    else:
        #queue = Queue()
        #wx_app = wx.App()
        #model_gui.MyFramelogin(None,queue).Show(False)
        #wx_app.MainLoop()
        thr = threading.Thread(target=key_mouse_api.shell_wondow,args=(os.path.abspath(sys.argv[0])+ " run",))
        thr.daemon = True
        thr.start()
        sys.exit()   

